// base.cpp
// Created by Fyniny on 2018/12/24.
//
#include "base.h"
using namespace base;
void base_::output(int count) {
    m_out_put_count += count;
    if (m_out_put_count >= m_max_output)
    {
        m_pcb.status = PROCESS_RESULT;
    }
}
base_::base_(int max_output,PCB* pcb) {
    if (pcb != nullptr)
    {
        m_pcb = *pcb;
    }
    m_out_put_count = 0;
    m_max_output = max_output;
}
int base_::getProcessStatus() const{
    return this->m_pcb.status;
}

int base_::getProcessID() const {
    return this->m_pcb.id;
}
bool base_::isDied() const {
    return m_pcb.status == PROCESS_RESULT;
}
void base_::setProcessStatus(int status) {
    if (m_pcb.status == PROCESS_RESULT) {
        return;
    }
    m_pcb.status = status;
}
base_::~base_() = default;
int base_::request(ReqBlock& req,Buffer& buffer) {
    return 0;
}